//
//  CommitMovieCommentViewController.m
//  PeopleStreet
//
//  Created by 辰领科技 on 16/3/24.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "CommitMovieCommentViewController.h"
#import "MovieCommentStartView.h"
@interface CommitMovieCommentViewController ()<UITextViewDelegate>
@property (strong, nonatomic) IBOutlet UIView *navView;
@property (strong, nonatomic) IBOutlet UIScrollView *scroView;
@property (strong, nonatomic) IBOutlet UIView *movieInfoView;
@property (strong, nonatomic) IBOutlet UILabel *movieName;
@property (strong, nonatomic) IBOutlet UILabel *movieScore;
@property (strong, nonatomic) IBOutlet UILabel *movieCommentNumber;
@property (strong, nonatomic) IBOutlet UILabel *movieType;
@property (strong, nonatomic) IBOutlet UILabel *movieTime;
@property (strong, nonatomic) IBOutlet UILabel *movieStartDate;
@property (strong, nonatomic) IBOutlet UILabel *NumberOfWordsLabel;//字数



@property (strong, nonatomic) IBOutlet UITextView *textView;
@property (strong, nonatomic) IBOutlet UILabel *placeHolder;


@property (strong, nonatomic) IBOutlet UIView *bottomView;
@property (strong, nonatomic) IBOutlet UIButton *commitButton;

@end

@implementation CommitMovieCommentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initViewLayout];
    // Do any additional setup after loading the view.
}

- (void)initViewLayout{
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.scroView];
    [self adaptiveViewLayout:self.movieInfoView];
    [self adaptiveViewLayout:self.bottomView];
    
    _scroView.contentSize = flexibleSize(CGSizeMake(0, 505), YES);
    _commitButton.layer.cornerRadius = 3*VerticalRatio();
    
    _textView.delegate = self;
    
    MovieCommentStartView * startview = [[MovieCommentStartView alloc]initWithFrame:flexibleFrame(CGRectMake(53, 203, 250, 40), NO) NumberOfStars:5 complect:^(CGFloat index) {
        
    }];
    [_scroView addSubview:startview];
    
     CommitStarsView * starts = [[CommitStarsView alloc]initWithFrame:flexibleFrame(CGRectMake(105, 37, 75, 15), YES) Stars:3.5];
    [_movieInfoView addSubview:starts];
    
    
    
    NSString *NumberOfWords = [NSString stringWithFormat:@"0"];
    NSString *remainingStr = [NSString stringWithFormat:@"%@/200",NumberOfWords];
    NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:remainingStr];
    [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:0.525 alpha:1.000] range:NSMakeRange(NumberOfWords.length, noteStr.length-NumberOfWords.length)];
  
    
    [self.NumberOfWordsLabel setAttributedText:noteStr];
    
}

- (IBAction)back:(id)sender {
    [self.navigationController  popViewControllerAnimated:YES];
}

#pragma mark == 评论
- (IBAction)commentHandel:(id)sender {
}



- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    
    _placeHolder.hidden = YES;
    
    return YES;
}
- (BOOL)textViewShouldEndEditing:(UITextView *)textView{
    if (_textView.text.length>0) {
        _placeHolder.hidden = YES;
    }else{
        _placeHolder.hidden = NO;
    }
    return YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
